﻿<%@ Page Language="C#" MasterPageFile="~/default.master" AutoEventWireup="true"
    CodeFile="ClientOrders.aspx.cs" Inherits="ClientOrders" %>

<%@ Register Src="~/controls/ctrlWait.ascx" TagName="ctrlWait" TagPrefix="ctrl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">
    <h2>
        <asp:Label ID="lblHeader" runat="server" Text="<%$ Resources:Language,MyOrders %>"></asp:Label>
    </h2>
    <ctrl:ctrlWait ID="ctrlWait" runat="server" />
    <asp:UpdatePanel ID="updatePanel1" runat="server">
        <ContentTemplate>
            <div class="vSeparate">
                <asp:RadioButtonList ID="rbl" runat="server" RepeatDirection="Horizontal" AutoPostBack="True">
                    <asp:ListItem Selected="True" Value="1" Text="<%$Resources:Language,CurrentOrders %>"></asp:ListItem>
                    <asp:ListItem Value="2" Text="<%$Resources:Language,OrdersHistory %>"></asp:ListItem>
                </asp:RadioButtonList>
            </div>
            <div class="vSeparate">
                <asp:GridView ID="gvOrders" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    OnRowDataBound="gvOrders_RowDataBound" PageSize="15" OnSelectedIndexChanging="gvOrders_SelectedIndexChanging"
                    CssClass="ClientOrders-table" OnPageIndexChanging="gvOrders_PageIndexChanging">
                    <Columns>
                        <asp:BoundField DataField="IDrealization" HeaderText="<%$Resources:Language,OrderId %>" />
                        <asp:BoundField DataField="StartDate" HeaderText="<%$Resources:Language,ORderDate %>" />
                        <asp:BoundField DataField="EndDate" HeaderText="<%$Resources:Language,RealizationDate %>" />
                        <asp:BoundField DataField="TotalAmountBrutto" HeaderText="<%$Resources:Language,PriceBrutto %>" />
                        <asp:BoundField DataField="ShipmentCost" HeaderText="<%$Resources:Language,ShipmentCost %>" />
                        <asp:BoundField HeaderText="<%$Resources:Language,PAymentType %>" />
                        <asp:BoundField DataField="StatusString" HeaderText="<%$Resources:Language,Status %>" />
                        <asp:TemplateField HeaderText="<%$Resources:Language,ProformaInvoice %>">
                            <ItemTemplate>
                                <a href="#" onclick='<%#"window.open(\"Invoice.ashx?Id="+Eval("IDrealization")+"\");" %>'>
                                    <%=Resources.Language.ProformaInvoice%></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:CommandField SelectText="<%$Resources:Language,ShowProducts %>" ShowSelectButton="True" />
                        <asp:HyperLinkField DataNavigateUrlFields="IDRealization" DataNavigateUrlFormatString="~/cms/OrderEdit.aspx?RealizationID={0}"
                            Text="<%$Resources:Language,Edit %>" />
                    </Columns>
                    <SelectedRowStyle BackColor="#FFFFC0" />
                </asp:GridView>
            </div>
            <div class="vSeparate">
                <asp:Label ID="lblTitle" runat="server"><%=Resources.Language.ProductsFromSelectedOrder %>:</asp:Label>
            </div>
            <div class="vSeparate">
                <asp:GridView ID="gvProducts" runat="server" AutoGenerateColumns="False" CssClass="ClientOrders-table">
                    <Columns>
                        <asp:BoundField DataField="ProductName" HeaderText="<%$Resources:Language,ProductName %>" />
                        <asp:BoundField DataField="PriceBrutto" HeaderText="<%$Resources:Language,Price %>" />
                        <asp:BoundField DataField="Count" HeaderText="<%$Resources:Language,Amount %>" />
                    </Columns>
                </asp:GridView>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="gvOrders" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
